using UnityEngine;
using UnityEngine.UI;
using QFramework;
using System;

namespace QFramework.Adventure
{
	public class TipPanelData : UIPanelData
	{
		public string content01;
		public Action action;
	}
	public partial class TipPanel : UIPanel
	{
		protected override void OnInit(IUIData uiData = null)
		{
			mData = uiData as TipPanelData ?? new TipPanelData();
			// please add init code here
		}
		
		protected override void OnOpen(IUIData uiData = null)
		{
			text_content.text = mData.content01;
			UIEventTrigger.Get(btn_sure).onClick += SureFun;
			UIEventTrigger.Get(btn_close).onClick += CloseeFun;
		}


		protected override void OnShow()
		{
		}
		
		protected override void OnHide()
		{
		}
		
		protected override void OnClose()
		{
            UIEventTrigger.Get(btn_sure).onClick -= SureFun;
            UIEventTrigger.Get(btn_close).onClick += CloseeFun;
        }
        //===============>
        private void SureFun(GameObject go)
        {
			AudioKit.PlaySound(GameConfig.Auido_Btn01);
            mData.action.Invoke();
			CloseSelf();
        }
        private void CloseeFun(GameObject go)
        {
            CloseSelf();
            AudioKit.PlaySound(GameConfig.Auido_Btn01);
        }



    }
}
